using My.ExcelToData.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;

namespace My.ExcelToData.Permissions;

public class ExcelToDataPermissionDefinitionProvider : PermissionDefinitionProvider
{
    public override void Define(IPermissionDefinitionContext context)
    {
        var myGroup = context.AddGroup(ExcelToDataPermissions.GroupName);
        //Define your own permissions here. Example:
        //myGroup.AddPermission(ExcelToDataPermissions.MyPermission1, L("Permission:MyPermission1"));

        var excelDataPermission = myGroup.AddPermission(ExcelToDataPermissions.ExcelData.Default, L("Permission:ExcelData"));
        excelDataPermission.AddChild(ExcelToDataPermissions.ExcelData.Create, L("Permission:Create"));
        excelDataPermission.AddChild(ExcelToDataPermissions.ExcelData.Update, L("Permission:Update"));
        excelDataPermission.AddChild(ExcelToDataPermissions.ExcelData.Delete, L("Permission:Delete"));
    }

    private static LocalizableString L(string name)
    {
        return LocalizableString.Create<ExcelToDataResource>(name);
    }
}
